/**
 * @param {number} n - a positive integer
 * @return {number}
 */
export var hammingWeight = function (n) {
  let ret = 0
  while (n) {
    n &= n - 1
    ret++
  }
  return ret
}
